<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>1111aaaaabbbcc</title>
	</head>
	<body>
		<button onclick="golj()">001累加</button>
		<div style="width: 100%;height: 500px;">
			<div>1</div>
			<div>2</div>
		</div>
	</body>
	<script>
		let temp = '0001';
		function golj(){
			temp = incrementAndPad(temp)
		}
		
		function incrementAndPad(str) {
		// 将字符串转换为数字
		let num = parseInt(str, 10);
		// 累加
		num++;
		// 将数字转换回字符串，并使用padStart来保持四位数格式
		return num.toString().padStart(4, '0');
		}
		
	</script>
</html>